package com.bbex.controller;/**
 * Created by Administrator on 2018/7/5.
 */

import com.bbex.constant.Constants;
import com.bbex.pojo.GlobalMessageResponseVo;
import com.bbex.service.AppVersionService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;
import java.util.Map;

/**
 * Title :
 * Description : app版本
 * Create on : 2018年07月05
 * Copyright (C) zw.FinTec
 *
 * @author department:研发部
 *         username:TAOFEI
 * @version 修改历史:
 *          修改人 修改日期 修改描述
 *          -------------------------------------------<
 */

@Controller
@RequestMapping("/bbuni/version")
public class AppVersionController {
    @Resource
    private AppVersionService appVersionService;

    @RequestMapping("/getVersion")
    @ResponseBody
    public Mono getVersion(){
        String companyCode="HLWL201810170002";
        Map map = appVersionService.getVersion(companyCode);
        boolean flag = (boolean)map.get("flag");
        String msg = (String)map.get("msg");
        if (!flag){
            return Mono.just(GlobalMessageResponseVo.newErrorInstance(msg));
        }
        return Mono.just(GlobalMessageResponseVo.newSuccessInstance(map));

    }
    @RequestMapping("/getLink")
    @ResponseBody
    public Mono getLink(){
        String companyCode="HLWL201810170002";
        Map map = appVersionService.getLink(companyCode);
        boolean flag = (boolean)map.get("flag");
        String msg = (String)map.get("msg");
        if (!flag){
            return Mono.just(GlobalMessageResponseVo.newErrorInstance(msg));
        }
        return Mono.just(GlobalMessageResponseVo.newSuccessInstance(map));

    }


}
